home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / windows5 / xwinc100.zip / CONTRIB-.00 / CONTRIB- / contrib / examples / PEX / tristrip2.c < prev    next >
C/C++ Source or Header  |  1991-02-16  |  3KB  |  84 lines

  1. /* $XConsortium: tristrip2.c,v 5.1 91/02/16 09:32:36 rws Exp $ */
  2.  
  3. /***********************************************************
  4. Copyright (c) 1991 by Sun Microsystems, Inc. and the X Consortium.
  5.  
  6.                         All Rights Reserved
  7.  
  8. Permission to use, copy, modify, and distribute this software and its 
  9. documentation for any purpose and without fee is hereby granted, 
  10. provided that the above copyright notice appear in all copies and that
  11. both that copyright notice and this permission notice appear in 
  12. supporting documentation, and that the names of Sun Microsystems,
  13. the X Consortium, and MIT not be used in advertising or publicity 
  14. pertaining to distribution of the software without specific, written 
  15. prior permission.  
  16.  
  17. SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 
  18. INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT 
  19. SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 
  20. DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  21. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  22. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  23. SOFTWARE.
  24.  
  25. ******************************************************************/
  26.  
  27. #ifdef BWEE
  28. The following program draws some triangle strips with reflectange equation
  29. setting = PREFL_AMBIENT.  It is expected that the triangle strips be rendered
  30. with the current interior colour since the current light source state is empty
  31. This program originated from a bug report created by the InsPEX test group.
  32. #endif
  33.  
  34.  
  35. #include "phigs/phigs.h"
  36.  
  37. main(argc,argv)
  38.         int argc; char **argv;
  39. {
  40.  
  41. static Ppoint3 pts1[] = {0.3,0.6,0.0, 0.5,0.5,0.5, 0.7,0.6,0.0, 0.7,0.4,0.0};
  42. static Ppoint3 pts2[] = {0.3,0.6,0.0, 0.5,0.5,0.5, 0.3,0.4,0.0, 0.7,0.4,0.0};
  43.  
  44. Pfacet_vdata_arr3 vdata1;
  45. Pfacet_vdata_arr3 vdata2;
  46.  
  47. static Ppoint3 farea[]= {0.2,0.9,0.0, 0.1,0.7,0.0, 0.0,0.8,0.0};
  48. Ppoint_list3 fset;
  49.  
  50. vdata1.points = pts1;
  51. vdata2.points = pts2;
  52. fset.num_points = 3;
  53. fset.points = farea;
  54.  
  55. popen_phigs(NULL,0);
  56. popen_ws(1,NULL,phigs_ws_type_x_tool);
  57. popen_struct(1);
  58.  
  59. pset_int_style(PSTYLE_SOLID);
  60. pset_int_colr_ind(3);
  61. pset_int_shad_meth(PSD_NONE);
  62.  
  63. pset_refl_eqn(PREFL_AMBIENT);
  64.  
  65. if (argc == 1) {
  66.     ptri_strip3_data(PFACET_NONE,PVERT_COORD,PMODEL_RGB,4,NULL,&vdata1);
  67.     ptri_strip3_data(PFACET_NONE,PVERT_COORD,PMODEL_RGB,4,NULL,&vdata2);
  68. } else {
  69.         pfill_area_set3(1,&fset); 
  70. }
  71.  
  72. ppost_struct(1,1,1.0);
  73.  
  74. if (argc == 1) {
  75.     printf("a triangle strip. press return...");
  76. } else {
  77.     printf("a fill area set with the same attributes. press return...");
  78. }
  79. getchar();
  80.  
  81. }
  82.  
  83.  
  84.